<#--
	这是一个分页模板。在需要使用分页的页面导入 <@pager.p page=groups.number+1 totalPages=groups.totalPages functionName="pagingForward"/>就可以实现分页。使用该模板需要注意一下几点
	1.调用时需传入3个参数 page（当前页） totalPages（总页数）functionName（调用方法名称）
 -->
    <#macro p page totalPages functionName>  
        <#assign pageNo=page?number>  
        <#--这个是分页显示的页数，默认7-->
		<#assign pageCount=7>
		<#assign prePageCount=5>
	<div class="row">
		<div class="col-sm-5 table-toolbar-left">
			<!--<div class="dataTables_info" id="dt-basic_info" role="status" aria-live="polite">显示 ${(pageNo-1)*pageCount+1} 到 ${pageNo*pageCount} 共 ${totalPages*pageCount} 条</div>-->
		</div>
		<div class="col-sm-7 table-toolbar-right">
			<div class="dataTables_paginate paging_simple_numbers" id="dt-basic_paginate">
				<ul class="pagination">
					<#if pageNo?? &&  totalPages gt 0>
						<#if totalPages lte pageCount  >
							<!--<li class="paginate_button previous disabled" id="dt-basic_previous">
                                <a href="#" aria-controls="dt-basic" data-dt-idx="0" tabindex="0">上一页</a>
                            </li>-->
							<#list 1..totalPages as a>
								<#if a=pageNo>
									<li class="paginate_button active">
										<a href="javascript:void(0)" aria-controls="dt-basic" data-dt-idx="${a}" tabindex="0">${a}</a>
									</li>
								<#else>
									<li class="paginate_button ">
										<a href="javascript:void(0)" onclick='${functionName}(${a})' aria-controls="dt-basic" data-dt-idx="${a}" tabindex="0">${a}</a>
									</li>
								</#if>
							</#list>
						</#if>
						<#if totalPages gt pageCount  >
							<#if totalPages-pageNo lt pageCount  >
								<#assign pageEnd=totalPages>
								<#assign pageBegin=totalPages-pageCount+1>
							<#elseif pageNo gt 3  >
								<#assign pageBegin=pageNo-3>
								<#assign pageEnd=pageBegin+prePageCount-1>
							<#else>
								<#assign pageBegin=1>
								<#assign pageEnd=prePageCount>
							</#if>

							<#if pageBegin gt 1  >
							<li class="paginate_button previous" id="dt-basic_previous">
                                <a href="javascript:void(0)" onclick='${functionName}(${pageNo-1})' aria-controls="dt-basic" data-dt-idx="0" tabindex="0">上一页</a>
                            </li>
							</#if>
							<#list pageBegin..pageEnd as a>
								<#if pageNo gt 3  >
								</#if>
								<#if a=pageNo>
								    <li class="paginate_button active">
										<a href="javascript:void(0)" aria-controls="dt-basic" data-dt-idx="${a}" tabindex="0">${a}</a>
									</li>
								<#else>
									<li class="paginate_button ">
										<a href="javascript:void(0)" onclick='${functionName}(${a})' aria-controls="dt-basic" data-dt-idx="${a}" tabindex="0">${a}</a>
									</li>
								</#if>
							</#list>

							<#if totalPages -pageEnd gt 0  >
								<li class="paginate_button disabled" id="dt-basic_ellipsis">
									<a href="javascript:void(0)" aria-controls="demo-dt-basic" data-dt-idx="${pageEnd+1}" tabindex="0">…</a>
								</li>
								<li class="paginate_button ">
									<a href="javascript:void(0)" onclick='${functionName}(${totalPages-1})' aria-controls="dt-basic" data-dt-idx="${totalPages-1}" tabindex="0">${totalPages-1}</a>
								</li>
								<li class="paginate_button ">
									<a href="javascript:void(0)" onclick='${functionName}(${totalPages})' aria-controls="dt-basic" data-dt-idx="${totalPages}" tabindex="0">${totalPages}</a>
								</li>
							</#if>

							<#if pageNo lt (totalPages)>
								<li class="paginate_button next" id="dt-basic_next">
									<a href="javascript:void(0)" onclick='${functionName}(${pageNo+1})' aria-controls="dt-basic" data-dt-idx="${pageNo}" tabindex="0">下一页</a>
								</li>
							</#if>
						</#if>
					</#if>
				</ul>
			</div>
		</div>
    </div>
    </#macro>  